package users;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import papers.Manuscript;

/**
 * A type of user that reviews papers
 * @author Shawn Paul Smith
 */

public class Reviewer extends User {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * All the papers that this user is responsible for reviewing.
	 */
	private List<Manuscript> myPapers;
	
	/* @ assignable myPapers @ */
	/* @ ensures myPapers.size() == 0 @ */
	/**
	 * Creates a new Reviewer user.
	 * @param name The name of this user.
	 * @param email The email address of this user.
	 */
	public Reviewer(String name) {
		super(name);
		myPapers = new ArrayList<Manuscript>();
	}
	
	/* @ ensures myPapers.size() == \old(myPapers).size() + 1 @ */
	/**
	 * Add manuscript to user.
	 */
	public void addAssignedManuscript (
			Manuscript manuscript) {
		myPapers.add(manuscript);
	}
	
	/* @ pure @ */
	/** 
	 * @return All the manuscripts assigned to this
	 * reviewer, as an unmodifiable list.
	 */
	public List<Manuscript> getAssignedManuscripts() {
		return Collections.unmodifiableList(myPapers);
	}
	/**
	 * Return Reviewer.
	 */
	public String getRole(){
		return "Reviewer";
	}
	/**
	 * Deletes paper from list of assigned papers.
	 * @param paper
	 */
	public void delete(Manuscript paper){
		myPapers.remove(paper);
	}
}
